/**
 * Created by 小敏哥 on 2017/8/21.
 */
import {
    TEST_IMG, INSURANCE_IMG, IDCARD_OBVERSE_IMG, IDCARD_BACK_IMG, TAX_IMG, LICENSE_OBVERSE_IMG, LICENSE_BACK_IMG,
    USERANDCARD_IMG, CERTIFICATE_IMG,
} from "../actions/actionsTypes"

let initState={
    testImg:{
        url:'',
        loaded:false
    }
};

export default function uploadPageReducer(state = initState, action) {
    switch (action.type) {
        case TEST_IMG:
            return Object.assign({}, state, {testImg: action.data});
        case INSURANCE_IMG:
            return Object.assign({}, state, {insuranceImg: action.data});
        case IDCARD_OBVERSE_IMG:
            return Object.assign({}, state, {idCardObverseImg: action.data});
        case IDCARD_BACK_IMG:
            return Object.assign({}, state, {idCardBackImg: action.data});
        case TAX_IMG:
            return Object.assign({}, state, {taxImg: action.data});
        case LICENSE_OBVERSE_IMG:
            return Object.assign({}, state, {licenseObverseImg: action.data});
        case LICENSE_BACK_IMG:
            return Object.assign({}, state, {licenseBackImg: action.data});
        case USERANDCARD_IMG:
            return Object.assign({}, state, {userAndCardImg: action.data});
        case CERTIFICATE_IMG:
            return Object.assign({},state,{certificateImage:action.data});
        default:
            return state;
    }
}